package com.newdjk.newdoctor.adapter;

import android.text.TextUtils;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.newdjk.newdoctor.MyApplication;
import com.newdjk.newdoctor.R;
import com.newdjk.okhttp.entity.ActivityListEntity;
import com.newdjk.okhttp.entity.SystemListEntity;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;

public class ActivityListAdapter extends BaseQuickAdapter<ActivityListEntity.ReturnDataBean, BaseViewHolder> {

    List<ActivityListEntity.ReturnDataBean> mPaintList;

    public ActivityListAdapter(@Nullable List<ActivityListEntity.ReturnDataBean> data) {
        super(R.layout.activity_item_list, data);
        mPaintList = data;
    }

    @Override
    protected void convert(@NotNull BaseViewHolder helper, ActivityListEntity.ReturnDataBean returnDataBean) {

        //501下单成功通知   502发货通知  503 取消通知  504订单退款通知   505订单退款失败通知   506订单完成
        //消息类型(1-开方后信息，2-审核后信息，3-核对后信息，4-作废后信息)
        TextView ordertext = helper.findView(R.id.order_type_desc);

        helper.setText(R.id.order_type_desc, returnDataBean.getMessageTitle() + "");
        int isread = returnDataBean.getIsRead();
        if (isread == 0) {
            helper.setVisible(R.id.order_unread_num, true);
        } else {
            helper.setVisible(R.id.order_unread_num, false);

        }

        helper.setText(R.id.tv_message_content, TextUtils.isEmpty(returnDataBean.getMessageContent()) ? "" : returnDataBean.getMessageContent());
        String time = returnDataBean.getMessageTime();
        if (TextUtils.isEmpty(time)) {
            helper.setText(R.id.time, "");
        } else {
            helper.setText(R.id.time, "" + returnDataBean.getMessageTime().substring(0, 11));
        }

    }


}